<template>
  <view class="content">
    <u-cell-group>
      <u-cell title="用户" :value="vuexUser.name"></u-cell>
      <u-cell title="令牌" :value="vuexToken"></u-cell>
      <u-cell title="版本" :value="vuexVersion"></u-cell>
      <u-cell title="日期时间" :value="$u.dayjs().format('YYYY-MM-DD HH:mm:ss dddd')"></u-cell>
      <u-cell title="日期时间ISO" :value="$u.dayjs().format()"></u-cell>
    </u-cell-group>
    <u-button
      class="launch-request"
      type="primary"
      text="发起请求"
      @click="onClickLaunchRequestButton"
    ></u-button>

    <u-gap height="20"></u-gap>

    <u-button
      type="primary"
      text="解码Base64的查询字符串值"
      @click="onClickDecodeBase64Button('name=5byg5LiJ&年龄=MTg=')"
    ></u-button>

    <u-gap height="20"></u-gap>

    <u-button
      type="primary"
      text="未Base64编码的查询字符串值，不受影响"
      @click="onClickDecodeBase64Button('name=张三&年龄=18')"
    ></u-button>
  </view>
</template>

<script>
export default {
  data() {
    return {};
  },

  methods: {
    /**
     * 点击发起请求
     */
    onClickLaunchRequestButton() {
      this.$u.api.his.getConfig();
      this.$u.api.his.getConfig();
      this.$u.api.qiyuesuo.nowSync();
      this.$u.api.qiyuesuo.nowSync();
    },

    /**
     * 点击解码Base64
     */
    onClickDecodeBase64Button(query) {
      uni.$u.route({
        url: `pages/decode-base64/decode-base64?${query}`,
      });
    },
  },
};
</script>

<style lang="scss" scoped>
.content {
  color: pink;
  padding: 20rpx;
}

.launch-request ::v-deep .u-button__text {
  color: #ff0000;
}
</style>
